home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / me_cd25.zip / MUTT2.ZIP / MAILMODE.MUT < prev    next >
Text File  |  1992-11-09  |  2KB  |  66 lines

  1. ;; mailmode.mut :  Stuff for replying to or composing mail/notes messages.
  2. ;; A super set of text mode.
  3. ;; Routines:
  4. ;;   mail-quote-region:
  5. ;;     Put a symbol infront of each line of text (ignore empty lines) in
  6. ;;     the region to indicate that somebody else wrote it.
  7. ;; C Durland    Public Domain
  8.  
  9. (const quoter "> ")        ;; what to put in front of quoted text
  10.  
  11. (defun
  12.   mail-mode
  13.   {
  14.     (text-mode)
  15.     (minor-mode "Mail")
  16.     (bind-local-key "mail-format-quote-region" "M-`")
  17.  
  18.     (if (pgm-exists "mail-mode-hook") (floc "mail-mode-hook"()))
  19.   }
  20. )
  21.  
  22. (include me2.h)
  23. (include runblock.mut)
  24.  
  25. (defun
  26.   what-do-you-want-to-quote-with (bool ask-them) HIDDEN
  27.   {
  28.     (if ask-them
  29. ;      { (ask-user) (concat (ask "what do you want to quote with? ") quoter) }
  30.       { (ask-user) (ask "what do you want to quote with? ") }
  31.       quoter
  32.     )
  33.   }
  34.   mail-quote-region { (run-pgm-on-block (floc quote-a-line-of-text) quoter) }
  35.   mail-format-quote-region
  36.   {
  37.     (byte type)(small-int left-edge width height)(int size)    ;; RegionInfo
  38.  
  39.     (int mark-id)
  40.     (string the-quote)
  41.  
  42.     (region-stats (loc type) THE-DOT THE-MARK TRUE)
  43.     (the-quote (what-do-you-want-to-quote-with (arg-flag)))
  44.  
  45.     (set-mark (mark-id (create-mark)))
  46.  
  47.     (adjust-lines height
  48.       (- (if (== 0 (word-wrap)) 72 (word-wrap)) (length-of the-quote))
  49.       FALSE)
  50.  
  51.     (forward-line -1)(set-mark)
  52.     (goto-mark mark-id)(free-mark mark-id)
  53.     (run-pgm-on-block (floc quote-a-line-of-text) the-quote)
  54.   }
  55. )
  56.  
  57. ;;;;;;;;;;;;;;;;;;;;;;;;; details ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  58. (defun
  59.   quote-a-line-of-text (string quoter) HIDDEN
  60.   {
  61.     (if (looking-at '\ *$')
  62.       { (arg-prefix 1)(cut-line)(open-line) }    ;; clear blank line
  63.       (insert-text quoter))            ;; add the quote mark
  64.   }
  65. )
  66.